<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">

	function confirmSubmit()
	{
	var agree=confirm("Are you sure you wish to Delete?");
	if (agree)
		return true ;
	else
		return false ;
	}
	
	function checkEmpty()
	{
		
		v = document.getElementById("attributeSet.name").value ;
		if ((v == "")) {
	    	alert("Enter Attribute set name.");
	    	 return false;        
	    }
		
	}
	function dis()
	{
		
		if(document.getElementById('newAttributeSet').style.display=='block')
		{
			document.getElementById('newAttributeSet').style.display='none';
		}
		else
		{
			document.getElementById('newAttributeSet').style.display='block';
		}
	}
</script>

<div><h2>Attribute Sets</h2></div><br/>
<div>${msg}
${errorMsg}</div><br/>

<table>
<tr><td><b>Id</b></td><td><b>Name</b></td><td><b>Edit</b></td></tr>
<s:if test="attributeSets.size() > 0">
	<s:iterator value="attributeSets">
			<tr>
					<td><s:property value="uuid" /></td>					
					<td><s:property value="name" /></td>
					<td><a href="editAttributeSet?uuid=<s:property value="uuid" />&p=${p}"><b>Edit</b></a></td>	
					<td>
						<form action="deleteAttributeSet" method="post" id='attributeSet_<s:property value="uuid" />' onsubmit="return confirmSubmit()">
						<input type="hidden" name="pageSize" value="${pageSize}">
						<input type="hidden" name="p" value="${p}">
						<input type="hidden" name="uuid" value='<s:property value="uuid" />'>
						<input type="submit" name="Delete" value="Delete">
						</form>
					</td>
					</tr>
	</s:iterator>
</s:if>
</table>
<div id="newAttributeSet" style="display:none">
		<form action="saveAttributeSet" method="post" id="newAttributeSet" >
				<table>	<tr><td></td>
						<td>
								<input type="hidden" name="pageSize" value="${pageSize}">
								<input type="hidden" name="p" value="${p}">
								<input type="hidden" name="attributeSet.uuid" value='<s:property value="uuid" />'>
								<input type="text" name="attributeSet.name" id ="attributeSet.name" value='<s:property value="name" />'>
							
						</td><td><input type="submit" name="save" value="Save" onclick="return checkEmpty()"></td><td><input type="button" name="cancel" onclick="dis()" value="Cancel"></td></tr> </table></form>
</div>
<table><tr><td></td><td></td><td></td><td><a href="#" onclick="dis()"><b>New</b></a></td></tr></table>

